﻿import numpy as np

'''
学习网站链接：https://zhuanlan.zhihu.com/p/64221395
'''

# 1.基础数据结构
ar1 = np.array([1, 2])
print("一维数组:")
print(ar1)
print("轴数:")
print(ar1.ndim)
print("行列数:")
print(ar1.shape)
print("元素个数:")
print(ar1.size)

ar2 = np.array([[1, 1, 1], [1, 2, 3], [2, 2, 2], [2, 3, 4]])
print("二维数组:")
print(ar2)
print("轴数:")
print(ar2.ndim)
print("行列数:")
print(ar2.shape)
print("元素个数:")
print(ar2.size)

ar3 = np.array([[[1, 2], [2, 3], [3, 4]], [[11, 12], [12, 13], [13, 14]], [[21, 22], [22, 23], [23, 24]], [[31, 32], [32, 33], [33, 34]]])
print("三维数组:")
print(ar3)
print("轴数:")
print(ar3.ndim)
print("行列数:")
print(ar3.shape)
print("元素个数:")
print(ar3.size)

print("数据类型:")
print(type(ar1), type(ar2), type(ar3))
print("数据项类型:")
print(ar1.dtype, ar2.dtype, ar3.dtype)
print("单个元素占用字节数:")
print(ar1.itemsize, ar2.itemsize, ar3.itemsize)